﻿//02.Write a program that concatenates two text files into another text file.

using System;
using System.IO;

namespace ConcatFiles
{
    class ConcatFiles
    {
        static void Main()
        {
            StreamWriter newFile = new StreamWriter("newfile.txt");
            using (newFile)
            {
                StreamReader file1 = new StreamReader("file1.txt");
                using (file1)
                {
                    string a = file1.ReadToEnd();
                    newFile.WriteLine(a);
                }
                StreamReader file2 = new StreamReader("file2.txt");
                using (file2)
                {
                    string b = file2.ReadToEnd();
                    newFile.WriteLine(b);
                }
            }
        }
    }
}
